package com.exam.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.exam.entity.ApiResult;
import com.exam.mapper.AnswerMapper;
import com.exam.service.AnswerService;
import com.exam.util.ApiResultHandler;
import com.exam.vo.AnswerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AnswerServiceImpl implements AnswerService {

    @Resource
    private AnswerMapper answerMapper;

    @Override
    public ApiResult findAll(Integer page, Integer size) {
        //创建分页
        Page<AnswerVO> answerVOPage = new Page<>(page,size);
        //将查询到的数据装载到结构体中进行返回
        IPage<AnswerVO> answerVOIPage = answerMapper.findAll(answerVOPage);
        return ApiResultHandler.buildApiResult(200,"查询所有题库",answerVOIPage);

    }
}
